package com.example.backetballgame.store;

import com.example.backetballgame.item.*;
import com.example.backetballgame.player.Player;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Random;

/**
 * store factory
 */
public class StoreFactory {

    private final static String[] names = {"Tom", "John", "Alice", "Bob", "Mark", "Lucy", "Ann", "Tony", "Marry", "Lisa"};

    public static Player createPlayer() {
        Random random = new Random();

        int randomNameIndex = random.nextInt(names.length);

        String randomName = names[randomNameIndex];

        int strength = random.nextInt(100);
        int defense = random.nextInt(100);
        Player player = new Player(randomName, GoodPriceUtil.calculatePlayerPrice(strength, defense, 0));
        player.setGuid(StoreManage.getNumber());
        player.setStrength(strength);
        player.setDefense(defense);
        return player;
    }

    private final static List<StorePotion> regularPotion = new ArrayList<>();
    static {
        regularPotion.add(new EnergyPotion());
        regularPotion.add(new StrengthPotion());
        regularPotion.add(new DefensePotion());
        regularPotion.add(new PowerPotion());
    }

    public static List<StorePotion> createStorePotion() {
        return regularPotion;
    }
}